type Persones = {
  name: string
  age: number
  sex: boolean
}
const proxy = (object: any, k: any) => {
  return new Proxy(object, {
    get(target, prop, receiver) {
      console.log('get k=======>' + k);
      return Reflect.get(target, prop, receiver)
    },
    set(target, prop, value, receiver) {
      console.log('set k=======>' + k);
      return Reflect.set(target, prop, value, receiver)
    }
  })
}
const logAccess = <T>(object: T, k: keyof T) => {
  return proxy(object, k)
}
let man: Persones = logAccess({
  name: '小周',
  age: 12,
  sex: true
}, 'age')
let man2: Persones = logAccess({
  name: '小周',
  age: 12,
  sex: true,
  id: 7
}, 'id')
// man.age = 89
// console.log(man);
console.log(man2);
